export class Subscription {
  _finalizers: Function[] = []
  constructor() {
    this._finalizers = []
  }
  unsubscribe() {
    if (this._finalizers) {
      for (const fn of this._finalizers) {
        fn()
      }
    }
  }
  add(fn: Function) {
    this._finalizers.push(fn)
  }
}